using System;
using System.Collections.Generic;
using System.Text;
using System.Runtime.InteropServices;

/**
*@file       DBAccount_LoginSender.cs
*@brief      send message DBAccount_Login
*
*@author     graywind
*@version    1.0.0.1
*@data       2012/4/14
*/

//send message DBAccount_Login
public class msgDBAccount_Login
{
    public const int MessageId = (int)DBServerTypes.MessageType.DBAccount_Login;
    //TODO
	public int SessionId = NetLib.INVALID_SESSION;
	public dbserver.AccountInfo MsgContent = new dbserver.AccountInfo();
	/// <summary>
	/// Initializes a new instance of the <see cref="msgDBAccount_Login"/> class.
	/// </summary>
	/// <param name='session_id'>
	/// Session_id.
	/// </param>
	/// <param name='usr_name'>
	/// Usr_name.
	/// </param>
	/// <param name='usr_password'>
	/// Usr_password.
	/// </param>
	/// <param name='login_code'>
	/// Login_code.
	/// </param>
	public msgDBAccount_Login(int session_id, string usr_name, string usr_password, int login_code)
	{
		MsgContent.LoginCode = login_code;
		MsgContent.UsrName = usr_name;
		MsgContent.UsrPassword = usr_password;
	}
}

//handle message
public partial class gwMessagePort
{
    /// <summary>
    /// handle message
    /// </summary>
    /// <param name="msg">message wrapper of DBAccount_Login</param>
    public static void ProcessMessage(msgDBAccount_Login msg)
    {
        //TODO
        //Main Message:  msgDBServer
		msgDBServer mainMsg = new msgDBServer(msg.SessionId, msgDBAccount_Login.MessageId, ProtoNet<dbserver.AccountInfo>.IntoBytes(msg.MsgContent));
		gwMessagePort.ProcessMessage(mainMsg);
    }
}
